﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Manager;
using Model;
using ExtAspNet;
using System.Data;
using Manager.CustomerHelper;
namespace HealthSystem.sysAdmin
{
    public partial class LoginLog : BasePage
    {
        HW_LoginLogManager userLogManager = new HW_LoginLogManager();
        public override ModuleType Module
        {
            get
            {
                return ModuleType.OrgManager;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindGrid();
            }
        }
        protected void BindGrid()
        {
            int count=0;
            DataTable data=new DataTable ();
            if (actionbt.Text == "search")
            {
                string searchString = searchbox.Text;
                data = userLogManager.Search(Gird1.PageIndex, Gird1.PageSize, out count,searchString);
            }
            else
            {
                data = userLogManager.GetList(Gird1.PageIndex,Gird1.PageSize,out count);
               
            }
            Gird1.RecordCount = count;
            Gird1.DataSource = data;
            Gird1.DataBind();
        }
        protected void Search_Clik(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(searchbox.Text))
            {
                actionbt.Text = "";
            }
            else
            {
                actionbt.Text = "search";
            }
            BindGrid();
        }
        protected void PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e)
        {
            Gird1.PageIndex = e.NewPageIndex;
            BindGrid();
        }

    }
}